Skip to content

Fix Ruby 4.0 compatibility: replace CGI with URI in DirectFileStore#330

Open
dannote wants to merge 1 commit intoprometheus:mainfrom
dannote:fix-ruby-4-cgi-removal
Open

Fix Ruby 4.0 compatibility: replace CGI with URI in DirectFileStore#330
dannote wants to merge 1 commit intoprometheus:mainfrom
dannote:fix-ruby-4-cgi-removal

Conversation

@dannote
Copy link

@dannote dannote commented Feb 5, 2026

CGI.parse and CGI.escape methods were removed from the cgi gem in Ruby 4.0. The cgi gem now only provides CGI.escape/CGI.unescape for HTML escaping, and CGI.escapeURIComponent/CGI.unescapeURIComponent for URI components.

This PR replaces:

  • CGI::parse(query_string)URI.decode_www_form(query_string).to_h
  • CGI::escape in query string building → URI.encode_www_form

The uri module is part of Ruby's standard library and doesn't require an additional dependency.

Testing:

  • All existing specs pass
  • Tested manually with Ruby 4.0.1 in production environment

CGI.parse and CGI.escape were removed in Ruby 4.0.
Use URI.decode_www_form and URI.encode_www_form instead.

Signed-off-by: Danila Poyarkov <dev@dannote.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant